Welcome to the module Data Understanding Statistics so now you have a raw data set before we do anything further you have to first understand it what it is, what are it's properties, what are those attributes and if we have categorical attributes what we should do if we have numeric attributes what we should do so this module can show you all the detailed steps of a statistical understanding of your data first of all we are going to do the setup we need again our two must-have modules we have already played with them multiple times the first one is pandas we are going to import pandas as pd the second one is Numpy we are going to import Numpy as np and also we need to load the dataset and here you need to download the Spotify and YouTube sample data CSV in our module and then upload it into this panel of Google Colaboratory again you have done that multiple times you can drop the file here or you can click this class that is uploading the file to this place once you do that you have the 3 dots you copy the path and then you paste that path to this place now we can move on now you called pd that read_csv() and you know this is the path where you can get the CSV file basically the read CSV will return the value as a data frame to our df let's print out the first 5 rows of the df in here we can see that we have some name of the artist we have the track we have album we have album tap so on and so forth we have many attributes and let's get some general idea of your dataset we learned actually this info() multiple times this info() is again a very helpful tool for you to understand the big picture of your dataset in here we can see that we have number of rows which is 20,718 entries and we have the indexes which are 0-20717 and we also have 10 columns and the 10 columns are 0-9 and each of the column has the column's name and also that is the shape of your data frame in particular for each of the column we have the value that is 20,718 there is no missing value for this artist however we can see that we do have some missing value in the views in the likes in some other attributes so that missing value will be something we should pay special attention later on we either have to fill them or we have to drop them the next thing we need to pay attention to is the data type for the artist because it is basically a string as the name, it is object the same applies to the track to the album and to the album type however for the views which we can see is here and for the likes which we can see is here for the comments and that is the number of comments and for the stream that is another number those are the numeric attributes and then for the licensed which will be true or false and for the official video that will be another true or false as boolean here we make it as object so basically this is an initial understanding of your dataset of course if we are going to do preprocessing we may have to convert the views or likes into integers rather than floats we may have to make the license as 0 or 1 rather than just a true or false but that will be our next step in here we are going to build our understanding based on this big picture we also learned we can use describe() while the info can give you all the columns as a big picture the describe will give you the statistic understanding of numeric attributes in which we have 4 of them that is view, likes and comments and stream because they are numeric then we can have the certain attributes or the certain properties specialized for numeric attributes such as count mean standard deviation minimum and also maximum and also the quantiles of these numeric attributes so those numeric attributes can give us a distribution or statistic understanding of what it is that is the describe() okay so that will be the big picture of your data frame let's look into the details of the non numeric attributes first of all if they are not numeric they may be categorical because we may have finite labels of that attributes and we may have infinite labels as well but we have to test what it is and for the artist as we can see we have 20,000 of rows how many rows actually are from the same artist so the value_counts() is a very useful function for our nonnumeric attributes if you call the value_counts() from a non numeric attribute basically you are going to sort them out with the frequency of how we can see them that is why you can see that this Gorillaz has 10 of the rows so on and so forth non numeric attributes you can use this value_counts() to find out what is the most frequent label you have seen in your data set and automatically they will be sorted from the most frequent to the least frequent and you can also call the unique which we have seen before that is how many unique values we may have in terms of the actual value and the number of unique will give you just the number of how many unique how many unique values we will have and we can also go with this checking by value_counts() unique() and nunique() for all the non numeric columns so here I created a list of the columns which are artistic track albums and so on and so forth and then we can basically call the df the non numerical columns that number of unique and gets are the results at once so we have 2079 unique artists we have 17 thousands of unique track we have 11 thousands of unique album for the album type and licensed and official video we actually have only very limited labels we have only 3 types of album we have only 2 types of licensed and we have only 2 labels of official video for these categorical attributes then it will be really helpful if we can do the value count because we can draw some understanding of the portion of how the 3 labels take into the 100% how the 2 labels take the portion of 100% in this case I'm going to show you the album tab and here we have to create another data frame from the result that is the album type as well as the value counts for that particular album type so the result is a data frame album type we have 14,000 of them is the album and the 5000 of them is single and then 788 compilation so that will be a good understanding of how the distribution of the 3 labels in terms of the album type we can do the same thing for the licensed and official video for the license we can see once we apply the licensed and the value counts of licensed we have 14 thousands as the True and 6 thousands as the False for the official video we have 15 thousands as the True and 4 thousands as the False so that will give us a better understanding of how these categorical value are distributed the next part is numeric attributes which is the majority of the attributes I believe in your dataset so as we have already learned we can get the minimum and the maximum out is because we can see how they are in terms of the distribution that is actually related to one concept we call central tendency because we want to know what is the typical value of your data in terms of the numbers the typical value will be in the center and if you learned normal distribution you will know that in the center of the normal distribution it has the most frequent data you can see central tendency try to focus on what is the typical data you may have and the criteria for us to know the central tendency is the min and the max and the medium and the mod and also midrange and by definition the minimum is simply the least number and the maximum is the maximum number the medium a lot of people will be confused by the median and the mean mean is the average median is the quantile the average is sum up everything divided by the number of elements but median is if we sort all the numbers the value of that middle of the dataset will be your median and the mode will be the most frequent data you can see in here if you simply call the df.mode you actually will get a list of the different frequency we only need the most affectional one so this will return at list[0] that is our mode and in the midrange will basically be the center point if we just do the (max-min)/2 so those will be the statistical understanding for the central tendency and in here let's just feed the column as the views we know this is a numeric attribute and then we can see that the min and the max and the median they are printed out so of course they are just in numbers and at this moment the numbers is just so abstract and we actually cannot have a really good understanding of it other than we know that even some minimum is 0 but the maximum is really really large and I don't even can count it quickly and then we can actually apply for the columns that they are numeric at once you just need to define a function we call that getCentralTendency with the column name you're going to feed into because we just did a example here so the only thing you need to do is to feed the numerica columns and then feed all the numerical columns label into this list and then call a for loop and then you are going to get all the four statistic central tendency of these attributes out in contradiction with central tendency Dispersion is actually focused on the tail of your distribution because the tail represents what is the least fragment data you may have and in order to focus on the tail we need to know the range we need to know quantiles, variation, also standard deviation we are following the same approach we just did for the central tendency for the views we are going to create those statistic understanding of it by calling the range which is the max minus min the quantiles is actually a built in function you can get from any numerical column. You can call quantile and then you should feed the specific quantile you need 0.25 represents 25% or Q1 0.5 represents 50% of quantile, that is Q2 and 0.75 is actually Q 3 the variation will be calling directly from variation function and a standard derivation will be directly called from the column as well this is an extra line that is called IQR or inter quantile range this is an important criteria for us to know what is the typical value typical range typical data you can see in your data set if we can split your dataset from least to greatest by 4 even pieces then this IQR represents the center 2 pieces of your data basically that will be the most common data you can see that is our IQR so we can print out this IQR out and by the way IQR will be later used for detecting outer layers so you have to remember how to define the IQR and how to calculate the IQR as well we are going to revisit this IQR later on so when we print this statistic understanding out we are going to see all the results for those different criterias range quantiles in terms of Q1 Q2 and Q3 and IQR variation and standard deviation the same thing is we can actually define a function quite easy and just take a column name and then do the same thing we just did and then get out all the statistic understanding of the dispersion out so we just need to feed the numeric columns again for a for loop so that we get all the numeric understanding of the dispersion for those attributes the last part for the numeric attributes is correlation because a lot of algorithms a lot of methods we are going to learn in the data analysis part is actually assume the attributes are independent with each other which means that they are not correlated however that is not the case in the real life for example in this dataset the views and the likes as you can see they have a 0.89 positive correlation that is actually a very high correlation which means that the more people see this video the more people watching this video the more likes the video may have the same thing happens to the comments because the comments and the views has a correlation of 0.43 and the comments and the likes has a even higher like 0.63 so these attributes of course they are correlated because they are taking the same factor which is the popularity of the video or song into consideration but the correlation in this call is actually very useful to give you a better understanding of how exactly each of the attributes are related to each other if you find out there is a perfect correlation in this case 1.0 of course views will be 100% correlated with itself but if we find a 1.0 or near 1.0 between 2 different attributes basically means that you are likely to have duplicated attributes they may be in different scale they may be in different the currency but they are likely measure the same thing so that will be the thing you need to get from this correlation or corr() function that ends up our statistic understanding of our dataset and then next we are going to learn how to visualize them I will see you soon